VERSION 5.00
Begin VB.Form frmConversion 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "*"
   ClientHeight    =   2415
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   6870
   ClipControls    =   0   'False
   ControlBox      =   0   'False
   Icon            =   "frmConversion.frx":0000
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   161
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   458
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "*"
      Height          =   375
      Left            =   5280
      TabIndex        =   10
      Top             =   1800
      Width           =   1335
   End
   Begin VB.CommandButton cmdConvert 
      Caption         =   "*"
      Default         =   -1  'True
      Height          =   375
      Left            =   3840
      TabIndex        =   9
      Top             =   1800
      Width           =   1335
   End
   Begin VB.Frame fmeUnits 
      BorderStyle     =   0  'None
      Height          =   1455
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   6255
      Begin VB.TextBox txtTo 
         Height          =   285
         Left            =   720
         Locked          =   -1  'True
         TabIndex        =   7
         Top             =   960
         Width           =   2655
      End
      Begin VB.TextBox txtOrigin 
         Height          =   285
         Left            =   720
         MaxLength       =   24
         TabIndex        =   5
         Top             =   480
         Width           =   2655
      End
      Begin VB.ComboBox cboTo 
         Height          =   315
         Left            =   3480
         Style           =   2  'Dropdown List
         TabIndex        =   8
         Top             =   960
         Width           =   2655
      End
      Begin VB.ComboBox cboFrom 
         Height          =   315
         Left            =   3480
         Style           =   2  'Dropdown List
         TabIndex        =   6
         Top             =   480
         Width           =   2655
      End
      Begin VB.ComboBox cboType 
         Height          =   315
         Left            =   720
         Style           =   2  'Dropdown List
         TabIndex        =   4
         Top             =   0
         Width           =   2655
      End
      Begin VB.Label lblMessages 
         Caption         =   "*"
         Height          =   255
         Index           =   2
         Left            =   0
         TabIndex        =   3
         Top             =   960
         Width           =   735
      End
      Begin VB.Label lblMessages 
         Caption         =   "*"
         Height          =   255
         Index           =   1
         Left            =   0
         TabIndex        =   2
         Top             =   480
         Width           =   735
      End
      Begin VB.Label lblMessages 
         Caption         =   "*"
         Height          =   255
         Index           =   0
         Left            =   0
         TabIndex        =   1
         Top             =   0
         Width           =   735
      End
   End
End
Attribute VB_Name = "frmConversion"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim bpConverterLoaded As Boolean

Private Sub cboFrom_Click()
    On Error Resume Next
    Call RefreshConversion
End Sub

Private Sub cboTo_Click()
    On Error Resume Next
    Call RefreshConversion
End Sub

Private Sub cboType_Click()
    On Error Resume Next
    Dim lpCurrent As Long
    bpConverterLoaded = False
    fmeUnits.Enabled = False
    txtOrigin.Text = vbNullString
    txtTo.Text = vbNullString
    With cboFrom
        .Clear
        Select Case cboType.ListIndex
            Case 0
                .AddItem LoadGlobalLanguage(600)
                .AddItem LoadGlobalLanguage(601)
                .AddItem LoadGlobalLanguage(602)
                .AddItem LoadGlobalLanguage(603)
                .AddItem LoadGlobalLanguage(604)
                .AddItem LoadGlobalLanguage(605)
                .AddItem LoadGlobalLanguage(606)
                .AddItem LoadGlobalLanguage(607)
                .AddItem LoadGlobalLanguage(608)
                .AddItem LoadGlobalLanguage(609)
                .AddItem LoadGlobalLanguage(610)
                .AddItem LoadGlobalLanguage(611)
                .AddItem LoadGlobalLanguage(612)
            Case 1
                .AddItem LoadGlobalLanguage(613)
                .AddItem LoadGlobalLanguage(614)
                .AddItem LoadGlobalLanguage(615)
                .AddItem LoadGlobalLanguage(616)
                .AddItem LoadGlobalLanguage(617)
                .AddItem LoadGlobalLanguage(618)
                .AddItem LoadGlobalLanguage(619)
                .AddItem LoadGlobalLanguage(620)
                .AddItem LoadGlobalLanguage(621)
                .AddItem LoadGlobalLanguage(622)
                .AddItem LoadGlobalLanguage(623)
                .AddItem LoadGlobalLanguage(624)
                .AddItem LoadGlobalLanguage(625)
                .AddItem LoadGlobalLanguage(626)
                .AddItem LoadGlobalLanguage(627)
                .AddItem LoadGlobalLanguage(628)
                .AddItem LoadGlobalLanguage(629)
                .AddItem LoadGlobalLanguage(630)
                .AddItem LoadGlobalLanguage(631)
            Case 2
                .AddItem LoadGlobalLanguage(632)
                .AddItem LoadGlobalLanguage(633)
                .AddItem LoadGlobalLanguage(634)
                .AddItem LoadGlobalLanguage(635)
                .AddItem LoadGlobalLanguage(636)
                .AddItem LoadGlobalLanguage(637)
                .AddItem LoadGlobalLanguage(638)
                .AddItem LoadGlobalLanguage(639)
                .AddItem LoadGlobalLanguage(640)
                .AddItem LoadGlobalLanguage(641)
                .AddItem LoadGlobalLanguage(642)
                .AddItem LoadGlobalLanguage(643)
                .AddItem LoadGlobalLanguage(644)
                .AddItem LoadGlobalLanguage(645)
                .AddItem LoadGlobalLanguage(646)
                .AddItem LoadGlobalLanguage(647)
                .AddItem LoadGlobalLanguage(648)
                .AddItem LoadGlobalLanguage(649)
                .AddItem LoadGlobalLanguage(650)
                .AddItem LoadGlobalLanguage(651)
                .AddItem LoadGlobalLanguage(652)
                .AddItem LoadGlobalLanguage(653)
                .AddItem LoadGlobalLanguage(654)
                .AddItem LoadGlobalLanguage(655)
                .AddItem LoadGlobalLanguage(656)
                .AddItem LoadGlobalLanguage(657)
                .AddItem LoadGlobalLanguage(658)
                .AddItem LoadGlobalLanguage(659)
                .AddItem LoadGlobalLanguage(660)
                .AddItem LoadGlobalLanguage(661)
                .AddItem LoadGlobalLanguage(662)
                .AddItem LoadGlobalLanguage(663)
                .AddItem LoadGlobalLanguage(664)
                .AddItem LoadGlobalLanguage(665)
                .AddItem LoadGlobalLanguage(666)
            Case 3
                .AddItem LoadGlobalLanguage(667)
                .AddItem LoadGlobalLanguage(668)
                .AddItem LoadGlobalLanguage(669)
                .AddItem LoadGlobalLanguage(670)
                .AddItem LoadGlobalLanguage(671)
                .AddItem LoadGlobalLanguage(672)
                .AddItem LoadGlobalLanguage(673)
                .AddItem LoadGlobalLanguage(674)
            Case 4
                .AddItem LoadGlobalLanguage(675)
                .AddItem LoadGlobalLanguage(676)
                .AddItem LoadGlobalLanguage(677)
                .AddItem LoadGlobalLanguage(678)
                .AddItem LoadGlobalLanguage(679)
                .AddItem LoadGlobalLanguage(680)
                .AddItem LoadGlobalLanguage(681)
                .AddItem LoadGlobalLanguage(682)
                .AddItem LoadGlobalLanguage(683)
                .AddItem LoadGlobalLanguage(684)
                .AddItem LoadGlobalLanguage(685)
                .AddItem LoadGlobalLanguage(686)
                .AddItem LoadGlobalLanguage(687)
            Case 5
                .AddItem LoadGlobalLanguage(688)
                .AddItem LoadGlobalLanguage(689)
                .AddItem LoadGlobalLanguage(690)
                .AddItem LoadGlobalLanguage(691)
                .AddItem LoadGlobalLanguage(692)
                .AddItem LoadGlobalLanguage(693)
                .AddItem LoadGlobalLanguage(694)
                .AddItem LoadGlobalLanguage(695)
                .AddItem LoadGlobalLanguage(696)
                .AddItem LoadGlobalLanguage(697)
                .AddItem LoadGlobalLanguage(698)
                .AddItem LoadGlobalLanguage(699)
                .AddItem LoadGlobalLanguage(700)
                .AddItem LoadGlobalLanguage(701)
                .AddItem LoadGlobalLanguage(702)
                .AddItem LoadGlobalLanguage(703)
                .AddItem LoadGlobalLanguage(704)
                .AddItem LoadGlobalLanguage(705)
                .AddItem LoadGlobalLanguage(706)
                .AddItem LoadGlobalLanguage(707)
                .AddItem LoadGlobalLanguage(708)
            Case 6
                .AddItem LoadGlobalLanguage(709)
                .AddItem LoadGlobalLanguage(710)
                .AddItem LoadGlobalLanguage(711)
                .AddItem LoadGlobalLanguage(712)
                .AddItem LoadGlobalLanguage(713)
                .AddItem LoadGlobalLanguage(714)
                .AddItem LoadGlobalLanguage(715)
                .AddItem LoadGlobalLanguage(716)
                .AddItem LoadGlobalLanguage(717)
                .AddItem LoadGlobalLanguage(718)
        End Select
        .ListIndex = 0
    End With
    cboTo.Clear
    For lpCurrent = 0 To cboFrom.ListCount - 1
        cboTo.AddItem cboFrom.List(lpCurrent)
        DoEvents
    Next lpCurrent
    cboTo.ListIndex = 0
    bpConverterLoaded = True
    fmeUnits.Enabled = True
End Sub

Private Sub cmdCancel_Click()
    On Error Resume Next
    Unload frmConversion
End Sub

Private Sub RefreshConversion()
    On Error Resume Next
    Dim dblFrom As Double
    Dim dblTo As Double
    Dim strIn As String
    Dim bpIn As enuReturns
    If bpConverterLoaded = False Then
        Exit Sub
    End If
    Select Case cboType.ListIndex
        Case 0
            dblFrom = psbConversion_Press(cboFrom.ListIndex)
            dblTo = psbConversion_Press(cboTo.ListIndex)
        Case 1
            dblFrom = psbConversion_Length(cboFrom.ListIndex)
            dblTo = psbConversion_Length(cboTo.ListIndex)
        Case 2
            dblFrom = psbConversion_Volume(cboFrom.ListIndex)
            dblTo = psbConversion_Volume(cboTo.ListIndex)
        Case 3
            dblFrom = psbConversion_Heat(cboFrom.ListIndex)
            dblTo = psbConversion_Heat(cboTo.ListIndex)
        Case 4
            dblFrom = psbConversion_Area(cboFrom.ListIndex)
            dblTo = psbConversion_Area(cboTo.ListIndex)
        Case 5
            dblFrom = psbConversion_Weight(cboFrom.ListIndex)
            dblTo = psbConversion_Weight(cboTo.ListIndex)
        Case 6
            dblFrom = psbConversion_Power(cboFrom.ListIndex)
            dblTo = psbConversion_Power(cboTo.ListIndex)
    End Select
    strIn = CalculateString(Trim(txtOrigin.Text), bpIn)
    If bpIn <> lpSucceed Then
        txtTo.Text = LoadGlobalLanguage(726)
    Else
        txtTo.Text = Trim(Str(dblFrom * Val(strIn) / dblTo))
    End If
End Sub

Private Sub cmdConvert_Click()
    On Error Resume Next
    Call RefreshConversion
End Sub

Private Sub Form_Load()
    On Error Resume Next
    bpConverterLoaded = False
    frmConversion.Caption = LoadGlobalLanguage(727)
    lblMessages(0).Caption = LoadGlobalLanguage(728)
    lblMessages(1).Caption = LoadGlobalLanguage(729)
    lblMessages(2).Caption = LoadGlobalLanguage(730)
    cmdConvert.Caption = LoadGlobalLanguage(731)
    cmdCancel.Caption = LoadGlobalLanguage(732)
    With cboType
        .AddItem LoadGlobalLanguage(719)
        .AddItem LoadGlobalLanguage(720)
        .AddItem LoadGlobalLanguage(721)
        .AddItem LoadGlobalLanguage(722)
        .AddItem LoadGlobalLanguage(723)
        .AddItem LoadGlobalLanguage(724)
        .AddItem LoadGlobalLanguage(725)
        .ListIndex = 0
    End With
    Call cboType_Click
    bpConverterLoaded = True
End Sub

Private Sub Form_Unload(Cancel As Integer)
    On Error Resume Next
    Cancel = False
    DoEvents
End Sub

Private Sub txtOrigin_Change()
    On Error Resume Next
    Call RefreshConversion
End Sub
